// JavaScript Document
function fnSoXe(value, element) 
{
	var regex = /^5[0-9]-[A-Z][0-9]-[0-9]{4}$/g;
	if(this.optional(element) || regex.test(value))
	{
		return true;
	}
	return false;
}

function fnMobile(value, element) 
{
	var regex = /^0[0-9]{9,10}$/g;
	if(this.optional(element) || regex.test(value))
	{
		return true;
	}
	return false;
}

function fnNgaySinh(value, element) 
{
	var ngaySinh = $("#NgaySinh").attr("value");
	var d1 = new Date(ngaySinh);
	var d2 = new Date();
	if(d2.getYear() - d1.getYear() >= 20)
	{
		return true;
	}
	return false;
}

function fnMatKhau(value, element) 
{
	var regex = /[$@,;]/g;
	if(this.optional(element) || regex.test(value))
	{
		return true;
	}
	return false;
}

function fnNhapLai(value, element) 
{
	var mk = $("#MatKhau").val();
	if(mk == value)
	{
		return true;
	}
	return false;
}

$.validator.addMethod("soxe", fnSoXe, "Khong dung so xe may Saigon");
$.validator.addMethod("mobile", fnMobile, "Khong dung so di dong Vietnam");
$.validator.addMethod("ngaysinh", fnNgaySinh, "Ngay sinh khong hop le");
$.validator.addMethod("matkhau", fnMatKhau, "Phai chua ky tu dac biet");
$.validator.addMethod("nhaplai", fnNhapLai, "Khong nhu mat khau da nhap");